/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.edu.vttu.taikhoan;

import java.awt.Component;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import javax.swing.table.TableModel;
import vn.edu.vttu.model.Loaiphong;
import vn.edu.vttu.model.NhanVien;
import vn.edu.vttu.phong.Phong_Quanly;
import vn.edu.vttu.readxml.ReadXML;

/**
 *
 * @author nhphuoc
 */
public class QuanLyTaiKhoan extends javax.swing.JFrame {

    class ItemRenderer extends BasicComboBoxRenderer {

        public Component getListCellRendererComponent(
                JList list, Object value, int index,
                boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index,
                    isSelected, cellHasFocus);

            if (value != null) {
                NhanVien item = (NhanVien) value;
                // đây là thông tin ta sẽ hiển thị , đối bảng khác sẽ khác cột chúng ta sẽ đổi lại tên tương ứng
                setText(item.getTenNV().toUpperCase());
            }

            if (index == -1) {
                NhanVien item = (NhanVien) value;
                setText("" + item.getTenNV());
            }
            return this;
        }
    }

    private void fillParentCombo() {
        Vector<NhanVien> model = new Vector<NhanVien>();  // khai báo vector đón dữ liệu từ server rả về
        try {
            ReadXML read = new ReadXML();
            Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
            vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
            model = common.selectNhanVien();

        } catch (Exception e) {
            e.printStackTrace();
            JOptionPane.showMessageDialog(rootPane, "Kết nối Server thất bại ");
        }

        DefaultComboBoxModel defaultComboBoxModel1 = new javax.swing.DefaultComboBoxModel(model);//model là  Vector<ParentRole> model = new Vector<ParentRole>();
        cobNhanVien.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
        cobNhanVien.setModel(defaultComboBoxModel1);
        cobNhanVien.setRenderer(new QuanLyTaiKhoan.ItemRenderer());  // chúng ta gỏ giống vậy
    }

    /**
     * Creates new form QuanLyTaiKhoan
     */
    public QuanLyTaiKhoan() {
        initComponents();
        loadData();
        enableButton(false);
    }
    private boolean them = false;

    public void loadData() {
        try {
            ReadXML read = new ReadXML();
            Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
            vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
            TableModel x = common.loadDataTaiKhoan();
            this.tblDSTaikhoan.setModel(x);

        } catch (Exception e) {
            e.printStackTrace();
            JOptionPane.showMessageDialog(rootPane, e);
        }
    }// load data

    private boolean KiemTraNhanVien(int ma) {
        boolean flag = false;
        try {
            ReadXML read = new ReadXML();
            Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
            vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
            TableModel x = common.KiemTraThemTaiKhoan(ma);
            if (x.getRowCount() >= 1) {
                flag = true;
            }
        } catch (Exception e) {
            flag = false;
        }
        return flag;
    }

    private boolean KiemTraTaiKhoan(String u) {
        boolean flag = false;
        try {
            ReadXML read = new ReadXML();
            Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
            vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
            TableModel x = common.KiemTraUsername(u);
            if (x.getRowCount() >= 1) {
                flag = true;
            }
        } catch (Exception e) {
            flag = false;
        }
        return flag;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        cobNhanVien = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        txtUsername = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        txtPass = new javax.swing.JPasswordField();
        btnThem = new javax.swing.JButton();
        btnLuu = new javax.swing.JButton();
        checkActive = new javax.swing.JCheckBox();
        btnSua = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        txtTimKiem = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblDSTaikhoan = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("QUẢN LÝ TÀI KHOẢN NGƯỜI DÙNG");

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(0, 0, 255));
        jLabel1.setText("QUẢN LÝ THÔNG TIN TÀI KHOẢN");

        jLabel2.setText("Nhân Viên:");

        jLabel3.setText("Username");

        txtUsername.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtUsernameFocusLost(evt);
            }
        });
        txtUsername.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtUsernameKeyTyped(evt);
            }
        });

        jLabel4.setText("Password");

        btnThem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vn/edu/vttu/img/user-add-icon.png"))); // NOI18N
        btnThem.setText("Thêm");
        btnThem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnThemActionPerformed(evt);
            }
        });

        btnLuu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vn/edu/vttu/img/Save-icon.png"))); // NOI18N
        btnLuu.setText("Lưu");
        btnLuu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLuuActionPerformed(evt);
            }
        });

        checkActive.setText("Active");

        btnSua.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vn/edu/vttu/img/edit-icon.png"))); // NOI18N
        btnSua.setText("Sửa");
        btnSua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSuaActionPerformed(evt);
            }
        });

        txtTimKiem.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtTimKiemKeyTyped(evt);
            }
        });

        tblDSTaikhoan.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tblDSTaikhoan.setRowHeight(25);
        tblDSTaikhoan.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblDSTaikhoanMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblDSTaikhoan);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(txtTimKiem, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jScrollPane1)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtTimKiem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vn/edu/vttu/img/Button-Refresh-icon.png"))); // NOI18N
        jButton1.setText("Reload");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnThem)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSua)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnLuu)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(271, 271, 271)
                                .addComponent(jLabel1))
                            .addGroup(layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cobNhanVien, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtPass, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkActive)))
                        .addGap(0, 22, Short.MAX_VALUE))
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(cobNhanVien, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(txtPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(checkActive))
                .addGap(23, 23, 23)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnThem)
                    .addComponent(btnLuu)
                    .addComponent(btnSua)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
private void enableButton(boolean b) {
        btnLuu.setEnabled(b);
        btnThem.setEnabled(!b);
        btnSua.setEnabled(!b);
        tblDSTaikhoan.setEnabled(!b);
    }
    private void tblDSTaikhoanMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblDSTaikhoanMouseClicked
        int index = tblDSTaikhoan.getSelectedRow();
        txtUsername.setText(String.valueOf(tblDSTaikhoan.getValueAt(index, 3)));
        txtPass.setText(String.valueOf(tblDSTaikhoan.getValueAt(index, 4)));
        String i = String.valueOf(tblDSTaikhoan.getValueAt(index, 6));
        if (i.equals("No")) {
            checkActive.setSelected(false);
        } else {
            checkActive.setSelected(true);
        }
        try {
            ReadXML read = new ReadXML();
            Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
            vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
            Vector<NhanVien> model2 = new Vector<NhanVien>();  // khai báo vector đón dữ liệu từ server rả về                          
            model2 = common.loadcobNhanVien(String.valueOf(tblDSTaikhoan.getValueAt(index, 1)));
            if (model2 != null) {

                DefaultComboBoxModel defaultComboBoxMode2 = new javax.swing.DefaultComboBoxModel(model2);//model là  Vector<ParentRole> model = new Vector<ParentRole>();
                cobNhanVien.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
                cobNhanVien.setModel(defaultComboBoxMode2);

                cobNhanVien.setRenderer(new QuanLyTaiKhoan.ItemRenderer());

            }
        } catch (Exception ex) {

        }
    }//GEN-LAST:event_tblDSTaikhoanMouseClicked

    private void btnThemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThemActionPerformed
        them = true;
        txtUsername.setText("");
        txtPass.setText(null);
        checkActive.setSelected(false);
        btnLuu.setEnabled(true);
        btnThem.setEnabled(false);
        btnSua.setEnabled(false);
        tblDSTaikhoan.setEnabled(false);
        tblDSTaikhoan.setEnabled(false);
        fillParentCombo();

    }//GEN-LAST:event_btnThemActionPerformed

    private void btnLuuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLuuActionPerformed
        String user = txtUsername.getText();
        String pass = MD5.encryptMD5(txtPass.getText());
        NhanVien nv = (NhanVien) cobNhanVien.getSelectedItem();
        Integer idnv = nv.getIdNV();
        int active = 0;
        if (checkActive.isSelected()) {
            active = 0;
        } else {
            active = 1;
        }
        if (user.equals("") || user.length() < 3 || user.length() > 30) {
            JOptionPane.showMessageDialog(rootPane, "Tên tài khoản không đúng");
            txtUsername.requestFocus();
        } else if (pass.equals("")) {
            JOptionPane.showMessageDialog(rootPane, "Mật khẩu không được bỏ trống và phải lớn hơn 3 ký tự");
            txtPass.requestFocus();
        } else {
            try {
                if (them == true) {
                    if (KiemTraNhanVien(idnv)) {
                        JOptionPane.showMessageDialog(rootPane, "Nhân viên này đã được tạo tài khoản");
                        cobNhanVien.requestFocus();
                    } else if (KiemTraTaiKhoan(user)) {
                        JOptionPane.showMessageDialog(rootPane, "Tên tài khoản đã được sử dụng");
                        txtUsername.requestFocus();
                    } else {
                        ReadXML read = new ReadXML();
                        Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
                        vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
                        boolean x = common.insertTaiKhoan(user, pass, idnv, active);
                        if (x) {
                            JOptionPane.showMessageDialog(rootPane, "Thêm tài khoản thành công");
                            loadData();
                            btnLuu.setEnabled(false);
                            btnThem.setEnabled(true);
                            btnSua.setEnabled(true);
                            tblDSTaikhoan.setEnabled(true);
                            tblDSTaikhoan.setEnabled(true);
                        } else {
                            JOptionPane.showMessageDialog(rootPane, "Thêm tài khoản không thành công");
                            loadData();
                            btnLuu.setEnabled(false);
                            btnThem.setEnabled(true);
                            btnSua.setEnabled(true);
                            tblDSTaikhoan.setEnabled(true);
                        }
                    }
                } else {

                    ReadXML read = new ReadXML();
                    Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
                    vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
                    boolean x = common.updateTaiKhoan((int) tblDSTaikhoan.getValueAt(tblDSTaikhoan.getSelectedRow(), 0), user, pass, idnv, active);
                    if (x) {
                        JOptionPane.showMessageDialog(rootPane, "Cập nhật tài khoản thành công");
                        loadData();
                        btnLuu.setEnabled(false);
                        btnThem.setEnabled(true);
                        btnSua.setEnabled(true);
                        tblDSTaikhoan.setEnabled(true);
                    } else {
                        JOptionPane.showMessageDialog(rootPane, "Cập nhật tài khoản không thành công");
                        loadData();
                        btnLuu.setEnabled(false);
                        btnThem.setEnabled(true);
                        btnSua.setEnabled(true);
                        tblDSTaikhoan.setEnabled(true);
                    }
                }
            } catch (Exception e) {
            }
        }
    }//GEN-LAST:event_btnLuuActionPerformed

    private void btnSuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuaActionPerformed
        them = false;
        enableButton(true);
        tblDSTaikhoan.setEnabled(false);

        fillParentCombo();
    }//GEN-LAST:event_btnSuaActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        loadData();
        enableButton(false);
        tblDSTaikhoan.setEnabled(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void txtTimKiemKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtTimKiemKeyTyped
        try {
            ReadXML read = new ReadXML();
            Registry registry = LocateRegistry.getRegistry(read.getInfo("ipServer"), Integer.parseInt(read.getInfo("portserver")));
            vn.edu.vttu.RMI_Interface common = (vn.edu.vttu.RMI_Interface) registry.lookup("ServerKhachSan");
            TableModel x = common.timKiemTaiKhoan(txtTimKiem.getText());
            if (x != null) {
                this.tblDSTaikhoan.setModel(x);
            }
        } catch (Exception e) {
            //e.printStackTrace();
            //JOptionPane.showMessageDialog(rootPane, e);
        }
    }//GEN-LAST:event_txtTimKiemKeyTyped

    private void txtUsernameKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtUsernameKeyTyped
        if (them == true) {
            if (KiemTraTaiKhoan(txtUsername.getText())) {
                JOptionPane.showMessageDialog(rootPane, "Tên tài khoản đã được sử dụng");
                txtUsername.setText(null);
                txtUsername.requestFocus();
            }
        }
    }//GEN-LAST:event_txtUsernameKeyTyped

    private void txtUsernameFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtUsernameFocusLost
        if (them == true) {
            if (KiemTraTaiKhoan(txtUsername.getText())) {
                JOptionPane.showMessageDialog(rootPane, "Tên tài khoản đã được sử dụng");
                txtUsername.setText(null);
                //txtUsername.requestFocus();
            }
        }
    }//GEN-LAST:event_txtUsernameFocusLost

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;

                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(QuanLyTaiKhoan.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(QuanLyTaiKhoan.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(QuanLyTaiKhoan.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(QuanLyTaiKhoan.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new QuanLyTaiKhoan().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnLuu;
    private javax.swing.JButton btnSua;
    private javax.swing.JButton btnThem;
    private javax.swing.JCheckBox checkActive;
    private javax.swing.JComboBox cobNhanVien;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tblDSTaikhoan;
    private javax.swing.JPasswordField txtPass;
    private javax.swing.JTextField txtTimKiem;
    private javax.swing.JTextField txtUsername;
    // End of variables declaration//GEN-END:variables
}
